import java.util.Scanner;

/**
 * Created by ospip on 2017/9/11.
 * Copyright (c) 2017 LLAP. All rights reserved.
 */
public class SpiralMatrix {
    protected int[][] m;
    public SpiralMatrix(int n) {
        this.m = new int[n][n];
        int t = 1, r = 0, c = 0, i;
        for (int step = n - 1; step >= 0; step -= 2, c++, r++) {
            if (step == 0) this.m[this.m.length / 2][this.m.length / 2] = n * n;
            for (i = t; t <= i + step - 1; t++) this.m[r][c++] = t;
            for (i = t; t <= i + step - 1; t++) this.m[r++][c] = t;
            for (i = t; t <= i + step - 1; t++) this.m[r][c--] = t;
            for (i = t; t <= i + step - 1; t++) this.m[r--][c] = t;
        }
    }
    public String toString() {
        String ret = new String();
        for (int i = 0; i < this.m.length; i++) {
            for (int j = 0; j < this.m.length; j++) {
                ret += this.m[i][j] + " ";
            }
            ret += "\n";
        }
        return ret;
    }
    public static void main(String[] args) {
        int matrixSize = new Scanner(System.in).nextInt();
        SpiralMatrix matrix = new SpiralMatrix(matrixSize);
        System.out.print(matrix.toString());
    }
}
